<template>
	<view class="container">
		<uni-section title="食物列表展示" type="line">
				<uni-list-item v-for="item in haochi" clickable @click="commentOne(item.id)" :title="item.comment"></uni-list-item>
		</uni-section>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				haochi:[]
			}
		},
		methods: {
			commentOne(id){
				uni.navigateTo({
					url:"../commentdetail/commentdetail?id="+id
				})
			}
		},
		onLoad() {
			uni.request({
				url:'http://localhost:8090/foodapp/comment/list',
				method:'post',
				success:res=>{
					if(res.data.success){
						this.haochi=res.data.list
					}
				},
				fail:()=>{},
				complete:()=>{}
			});
		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
</style>
